Skip to content

ML feature substrate: bounded, reproducible per-locus feature stream (rosalind features) - #28

Merged
logannye merged 4 commits into
mainfrom
rosalind/ml-feature-substrate
Jun 2, 2026
Merged

ML feature substrate: bounded, reproducible per-locus feature stream (rosalind features)#28
logannye merged 4 commits into
mainfrom
rosalind/ml-feature-substrate

Conversation

@logannye

@logannye logannye commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

The kernel already produces a bounded, deterministic per-locus PileupColumn stream; this exposes it as an ML feature substrate, landing the claim no other tool makes: byte-identical features → bit-reproducible training inputs, with a verifiable hash receipt.

  • call::features — a feature sink over the same streaming PileupEngine: every callable locus becomes a tabular row (contig, 1-based pos, ref, depth, raw_depth, A/C/G/T counts, per-allele fwd/rev strand counts, mean base-qual, mean mapq). stream_features_region + stream_features_whole_genome reuse the bounded per-contig driver (PerContig made pub(crate)), returning (WorkingSet, SkipCounts) like the germline path.
  • rosalind features CLI — streams the per-locus TSV under the same memory contract (plan predicts it, --enforce honors it exit 3/4, verify re-checks the receipt), with the row count in the manifest.
  • TSV-first (no new deps, one-line pd.read_csv(sep='\t')). Verified on the toy genome: 983,011 rows at 6 MiB peak (bounded), byte-identical across runs (the reproducibility claim).

Spec: docs/superpowers/specs/2026-06-02-ml-feature-substrate-design.md.

Deferred to a follow-up: Arrow/Parquet egress (zero-copy efficiency), a real pyarrow Python boundary (replacing the dead-end stub), and a reference-model demo. The TSV + receipt already deliver the core reproducibility claim; those are ergonomics/efficiency.

Test plan

  • cargo test green (unit: exact fields + determinism + bounded; integration: schema + byte-identical + receipt + verify + exit-3 refuse)
  • cargo fmt --all -- --check clean; 0 warnings (debug + release)
  • Verified locally: 983k-row feature TSV at 6 MiB peak, byte-identical across runs, verify: OK

🤖 Generated with Claude Code

logannye and others added 4 commits June 2, 2026 10:50
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A FEATURE sink over the same streaming PileupEngine: every callable locus is
emitted as a tabular row (contig, 1-based pos, ref, depth, raw_depth, ACGT
counts, per-allele fwd/rev strand counts, mean base-qual, mean mapq) instead of
only variant sites. stream_features_region + stream_features_whole_genome reuse
the bounded per-contig driver (PerContig made pub(crate)), returning
(WorkingSet, SkipCounts) like the germline path. Output is byte-identical
run-to-run (canonical obs order + integer-mean {:.2} formatting) — the basis for
bit-reproducible ML training inputs. Unit-tested for exact fields + determinism
+ bounded working set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… TSV

run_features mirrors run_variants_index (StreamingBamSource + the same --enforce
gate exit 3/4 + realized-peak receipt) but streams a feature row per callable
locus instead of variant calls. Verified on the toy genome: 983,011 rows at 6
MiB peak (bounded), byte-identical across runs (the reproducibility claim), with
the row count in the receipt. Integration tests cover the schema, byte-identical
output, the receipt + verify, and the exit-3 refuse under a tight budget.
'plan --index' already predicts this peak (same engine).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bounded + byte-identical per-locus features -> bit-reproducible ML training
inputs with a verifiable receipt; one-line pandas read; Arrow/pyarrow on the
roadmap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@logannye
logannye merged commit e4f43bf into main Jun 2, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant